package com.ffcs.crmd.tsp.common.netty;

/**
 * 
 * 功能说明:响应结果编码
 *
 * @author ZHONGFUHUA
 * 
 * @since 1.0.0-SNAPSHOT
 *
 */
public class ResponseCode {
    // 成功
    public static final int SUCCESS                    = 0;
    // 失败
    public static final int FAIL                       = 1;
    // 发生了未捕获异常
    public static final int SYSTEM_ERROR               = 2;
    // 由于线程池拥堵，系统繁忙
    public static final int SYSTEM_BUSY                = 3;
    // 请求代码不支持
    public static final int REQUEST_CODE_NOT_SUPPORTED = 4;
    // 请求执行发生异常
    public static final int EXCEPTION                  = 5;
    
    public static String getName(int code) {
        switch (code) {
            case 0:
                return "SUCCESS";
            case 1:
                return "FAIL";
            case 2:
                return "SYSTEM_ERROR";
            case 3:
                return "SYSTEM_BUSY";
            case 4:
                return "REQUEST_CODE_NOT_SUPPORTED";
            case 5:
                return "EXCEPTION";
        }
        return null;
    }
}
